gtk/window: Check widget mappdness and not surface mappedness
authorJonas Ådahl <jadahl@gmail.com>
Wed, 16 Dec 2020 09:10:00 +0000 (10:10 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 16 Dec 2020 10:56:41 +0000 (11:56 +0100)
commitb6412adc3288377c795abdb96622a5fac2ec382f
treede9c5bce5d7de670fd71366470e3d9617a6989cd
parent2192bb3dde2ad3c666b3087470e0af5dcfdaf371
gtk/window: Check widget mappdness and not surface mappedness

When deciding whether to call gdk_toplevel_present(), check the
mappedness of GtkWidget instead of the mapped-ness of GdkSurface, as the
latter is mapped asynchronously, while the former is direct state of the
GtkWindow itself.

This fixes an issue where calling e.g. gtk_window_maximize() shortly
after showing it didn't take effect, as hadn't been mapped yet. While
maximizing after showing is racy, and will likely glitch from time to
time, the correct thing to do is still to maximize and handle whatever
state the compositor configured the window to be in.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3466
gtk/gtkwindow.c